package com.ytclub.auth.entity;

import lombok.Getter;

/**
 * 返回结果状态枚举类
 *
 * @author: HuangQi
 * @date: Created in 21:39 2023/12/14
 * @description: 返回结果状态枚举
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),
    FAIL(500, "失败");
    private int code;
    private String desc;

    ResultCodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(int codeVal) {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if (resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }


}
